import gc
import time


class ClassA:
    pass

createVar = locals()
listTemp = range(1,10)
for i,s in enumerate(listTemp):
    print(gc.collect())  # 显式执行垃圾回收
    print(gc.garbage)
    createVar['a'+str(i)] = s
print(createVar['a2'])
print(createVar['__name__'])
print(createVar)

# def f3():
#     # print gc.collect()
#     c1 = ClassA()
#     c2 = ClassA()
#     c1.t = c2
#     c2.t = c1
#     del c1
#     del c2
#     print(gc.garbage)
#     print(gc.collect())  # 显式执行垃圾回收
#     print(gc.garbage)
#     time.sleep(10)
#
#
# if __name__ == '__main__':
#     gc.set_debug(gc.DEBUG_LEAK)  # 设置gc模块的日志
#     f3()
